<?php
$url = $_REQUEST['url'];
$url_parts = parse_url($url);
$method = $_REQUEST['method'];
$content_type = $_REQUEST['content_type'];
$content = $_REQUEST['content'];

$curlCon = curl_init($url);
curl_setopt($curlCon,CURLOPT_HEADER,false);
curl_setopt($curlCon,CURLOPT_NOBODY,false);
curl_setopt($curlCon, CURLOPT_CUSTOMREQUEST,$method);
$headers  =  array(
    "Content-type: $content_type",
    "Host: " . $url_parts['host'],
    "User-Agent: WHQ"
);
curl_setopt($curlCon,CURLOPT_HTTPHEADER,$headers);
curl_setopt($curlCon, CURLOPT_RETURNTRANSFER,true);
curl_setopt($curlCon, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curlCon, CURLOPT_POSTFIELDS, $content);
$pageContent = curl_exec($curlCon);
$headers = curl_getinfo($curlCon);

$response = array(
    'body'          => $pageContent,
    'http_code'     => $headers['http_code'],
    'content_type'  => $headers['content_type']
);

echo json_encode($response);

curl_close($curlCon);
?>